package com.xydtech.ecard.config.service.impl;

import com.xydtech.common.annotation.DataScope;
import com.xydtech.common.core.text.Convert;
import com.xydtech.common.utils.DateUtils;
import com.xydtech.common.utils.ShiroUtils;
import com.xydtech.ecard.config.domain.EcardPosterConfigure;
import com.xydtech.ecard.config.mapper.EcardPosterConfigureMapper;
import com.xydtech.ecard.config.service.IEcardPosterConfigureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 海报配置Service业务层处理
 * 
 * @author xydtech
 * @date 2022-12-05
 */
@Service
public class EcardPosterConfigureServiceImpl implements IEcardPosterConfigureService 
{
    @Autowired
    private EcardPosterConfigureMapper ecardPosterConfigureMapper;

    /**
     * 查询海报配置
     * 
     * @param id 海报配置主键
     * @return 海报配置
     */
    @Override
    public EcardPosterConfigure selectEcardPosterConfigureById(Long id)
    {
        return ecardPosterConfigureMapper.selectEcardPosterConfigureById(id);
    }

    /**
     * 查询海报配置列表
     * 
     * @param ecardPosterConfigure 海报配置
     * @return 海报配置
     */
    @Override
    @DataScope(deptAlias = "a", userAlias = "b")
    public List<EcardPosterConfigure> selectEcardPosterConfigureList(EcardPosterConfigure ecardPosterConfigure)
    {
        return ecardPosterConfigureMapper.selectEcardPosterConfigureList(ecardPosterConfigure);
    }

    /**
     * 新增海报配置
     * 
     * @param ecardPosterConfigure 海报配置
     * @return 结果
     */
    @Override
    public int insertEcardPosterConfigure(EcardPosterConfigure ecardPosterConfigure)
    {
        ecardPosterConfigure.setCreateTime(DateUtils.getNowDate());
        ecardPosterConfigure.setUserId(ShiroUtils.getUserId());
        return ecardPosterConfigureMapper.insertEcardPosterConfigure(ecardPosterConfigure);
    }

    /**
     * 修改海报配置
     * 
     * @param ecardPosterConfigure 海报配置
     * @return 结果
     */
    @Override
    public int updateEcardPosterConfigure(EcardPosterConfigure ecardPosterConfigure)
    {
        return ecardPosterConfigureMapper.updateEcardPosterConfigure(ecardPosterConfigure);
    }

    /**
     * 批量删除海报配置
     * 
     * @param ids 需要删除的海报配置主键
     * @return 结果
     */
    @Override
    public int deleteEcardPosterConfigureByIds(String ids)
    {
        return ecardPosterConfigureMapper.deleteEcardPosterConfigureByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除海报配置信息
     * 
     * @param id 海报配置主键
     * @return 结果
     */
    @Override
    public int deleteEcardPosterConfigureById(Long id)
    {
        return ecardPosterConfigureMapper.deleteEcardPosterConfigureById(id);
    }
}
